#define _CRT_SECURE_NO_WARNINGS 1

void ReverTree(struct TreeNode* root)
{
    if (root == NULL)
        return;

    struct TreeNode* tmp = root->left;
    root->left = root->right;
    root->right = tmp;

    ReverTree(root->left);
    ReverTree(root->right);
}

struct TreeNode* invertTree(struct TreeNode* root) {
    ReverTree(root);

    return root;
}